package cn.haocxy.jfm.util;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

public final class Utils {

	private Utils() {
	}

	public static <T> Collection<T> copy(Collection<T> c) {
		Set<T> res = new HashSet<>(c.size());
		for (T e : c) {
			res.add(e);
		}
		return res;
	}
	
	public static String getInitDir() {
		if (OS.isWin32()) {
			
			return "\\";
			
		} else if (OS.isLinux()) {
			
			String home = System.getenv("HOME").trim();
			if (home == null) {
				return "/";
			} else {
				return home;
			}
			
		} else {
			
			throw new RuntimeException("implement me!");
			
		}
	}
}
